package org.turnlink.sclm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.turnlink.sclm.dao.ContactListDao;
import org.turnlink.sclm.model.ContactList;
import org.turnlink.sclm.service.ContactListManager;

@Service
public class ContactListManagerImpl implements ContactListManager {

	@Autowired
	private ContactListDao contactListDao;
	
	@Override
	public void addContactsToList(Integer accountId, String listName, List<Integer> contactIds) {
		this.contactListDao.addContactsToList(accountId, listName, contactIds);
	}

	@Override
	public void create(ContactList contactList) {
		this.contactListDao.saveOrUpdate(contactList);
	}
	
	@Override
	public void update(ContactList contactList) {
		this.contactListDao.saveOrUpdate(contactList);
	}

	@Override
	public void remove(Integer accountId, String listName) {
		this.contactListDao.removeByAccountAndListName(accountId, listName);
	}

	@Override
	public void removeContactsFromList(Integer accountId, String listName, List<Integer> contactIds) {
		this.contactListDao.removeContactsFromList(accountId, listName, contactIds);
	}

}
